<template>
	<div>
		{{errorMessage}}
	</div>
</template>

<script>
	export default {
		data() {
			return {
				errorMessage:"恭喜您登录成功,页面正在跳转...."
			};
		},
		methods: {
			GetRequest(){
				var url = decodeURI(location.href); //获取url中"?"符后的字串
				var theRequest = new Object();
				if (url.indexOf("?") != -1) {
					var str = url.split("?")[1];
					var strs = str.split("&");
					for(var i = 0; i < strs.length; i ++) {
						theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);
					}
				}
				return theRequest;
			}
		},
		mounted(){
			var parma = this.GetRequest();
			var sessionId = parma.sessionId;
			var user = parma.user; //"{username:xxx, id:11}"

			//存储登录用户
			sessionStorage.setItem('user', JSON.stringify(user));
			//存储sessionID
			sessionStorage.setItem('sessionId', sessionId);

			this.$router.push({ path: '/echarts' });
		}
	}

</script>